package com.bookshop.logic;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTransfer {
	public static String formateDate(Date pDate) {
		SimpleDateFormat time = new SimpleDateFormat("yyyy-mm-dd");
		String subDate = time.format(pDate);
		return subDate;
	}
	
	public static Date formateDate(String pDate) {
		SimpleDateFormat time = new SimpleDateFormat("yyyy-mm-dd");
		Date date = null;
		try {
			date = time.parse(pDate);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return date;
	}
}
